3.1.3 \(\int x (a+b x) \sin (c+d x) \, dx\) [3]

Optimal. Leaf size=65 \[ \frac {2 b \cos (c+d x)}{d^3}-\frac {a x \cos (c+d x)}{d}-\frac {b x^2 \cos (c+d x)}{d}+\frac {a \sin (c+d x)}{d^2}+\frac {2 b x \sin (c+d x)}{d^2} \]

[Out]

2*b*cos(d*x+c)/d^3-a*x*cos(d*x+c)/d-b*x^2*cos(d*x+c)/d+a*sin(d*x+c)/d^2+2*b*x*sin(d*x+c)/d^2

________________________________________________________________________________________

Rubi [A]
time = 0.07, antiderivative size = 65, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 4, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.308, Rules used = {6874, 3377, 2717, 2718} \begin {gather*} \frac {a \sin (c+d x)}{d^2}-\frac {a x \cos (c+d x)}{d}+\frac {2 b \cos (c+d x)}{d^3}+\frac {2 b x \sin (c+d x)}{d^2}-\frac {b x^2 \cos (c+d x)}{d} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[x*(a + b*x)*Sin[c + d*x],x]

[Out]

(2*b*Cos[c + d*x])/d^3 - (a*x*Cos[c + d*x])/d - (b*x^2*Cos[c + d*x])/d + (a*Sin[c + d*x])/d^2 + (2*b*x*Sin[c +
 d*x])/d^2

Rule 2717

Int[sin[Pi/2 + (c_.) + (d_.)*(x_)], x_Symbol] :> Simp[Sin[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 2718

Int[sin[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Cos[c + d*x]/d, x] /; FreeQ[{c, d}, x]

Rule 3377

Int[((c_.) + (d_.)*(x_))^(m_.)*sin[(e_.) + (f_.)*(x_)], x_Symbol] :> Simp[(-(c + d*x)^m)*(Cos[e + f*x]/f), x]
+ Dist[d*(m/f), Int[(c + d*x)^(m - 1)*Cos[e + f*x], x], x] /; FreeQ[{c, d, e, f}, x] && GtQ[m, 0]

Rule 6874

Int[u_, x_Symbol] :> With[{v = ExpandIntegrand[u, x]}, Int[v, x] /; SumQ[v]]

Rubi steps

\begin {align*} \int x (a+b x) \sin (c+d x) \, dx &=\int \left (a x \sin (c+d x)+b x^2 \sin (c+d x)\right ) \, dx\\ &=a \int x \sin (c+d x) \, dx+b \int x^2 \sin (c+d x) \, dx\\ &=-\frac {a x \cos (c+d x)}{d}-\frac {b x^2 \cos (c+d x)}{d}+\frac {a \int \cos (c+d x) \, dx}{d}+\frac {(2 b) \int x \cos (c+d x) \, dx}{d}\\ &=-\frac {a x \cos (c+d x)}{d}-\frac {b x^2 \cos (c+d x)}{d}+\frac {a \sin (c+d x)}{d^2}+\frac {2 b x \sin (c+d x)}{d^2}-\frac {(2 b) \int \sin (c+d x) \, dx}{d^2}\\ &=\frac {2 b \cos (c+d x)}{d^3}-\frac {a x \cos (c+d x)}{d}-\frac {b x^2 \cos (c+d x)}{d}+\frac {a \sin (c+d x)}{d^2}+\frac {2 b x \sin (c+d x)}{d^2}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.07, size = 45, normalized size = 0.69 \begin {gather*} \frac {-\left (\left (a d^2 x+b \left (-2+d^2 x^2\right )\right ) \cos (c+d x)\right )+d (a+2 b x) \sin (c+d x)}{d^3} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[x*(a + b*x)*Sin[c + d*x],x]

[Out]

(-((a*d^2*x + b*(-2 + d^2*x^2))*Cos[c + d*x]) + d*(a + 2*b*x)*Sin[c + d*x])/d^3

________________________________________________________________________________________

Maple [A]
time = 0.04, size = 121, normalized size = 1.86

method result size
risch \(-\frac {\left (d^{2} x^{2} b +a \,d^{2} x -2 b \right ) \cos \left (d x +c \right )}{d^{3}}+\frac {\left (2 b x +a \right ) \sin \left (d x +c \right )}{d^{2}}\) \(47\)
norman \(\frac {\frac {4 b}{d^{3}}+\frac {a x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {b \,x^{2} \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {2 a \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d^{2}}-\frac {a x}{d}-\frac {b \,x^{2}}{d}+\frac {4 b x \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d^{2}}}{1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}\) \(107\)
derivativedivides \(\frac {a c \cos \left (d x +c \right )+a \left (\sin \left (d x +c \right )-\left (d x +c \right ) \cos \left (d x +c \right )\right )-\frac {b \,c^{2} \cos \left (d x +c \right )}{d}-\frac {2 b c \left (\sin \left (d x +c \right )-\left (d x +c \right ) \cos \left (d x +c \right )\right )}{d}+\frac {b \left (-\left (d x +c \right )^{2} \cos \left (d x +c \right )+2 \cos \left (d x +c \right )+2 \left (d x +c \right ) \sin \left (d x +c \right )\right )}{d}}{d^{2}}\) \(121\)
default \(\frac {a c \cos \left (d x +c \right )+a \left (\sin \left (d x +c \right )-\left (d x +c \right ) \cos \left (d x +c \right )\right )-\frac {b \,c^{2} \cos \left (d x +c \right )}{d}-\frac {2 b c \left (\sin \left (d x +c \right )-\left (d x +c \right ) \cos \left (d x +c \right )\right )}{d}+\frac {b \left (-\left (d x +c \right )^{2} \cos \left (d x +c \right )+2 \cos \left (d x +c \right )+2 \left (d x +c \right ) \sin \left (d x +c \right )\right )}{d}}{d^{2}}\) \(121\)
meijerg \(\frac {4 b \sqrt {\pi }\, \sin \left (c \right ) \left (\frac {x \left (d^{2}\right )^{\frac {3}{2}} \cos \left (d x \right )}{2 \sqrt {\pi }\, d^{2}}-\frac {\left (d^{2}\right )^{\frac {3}{2}} \left (-\frac {3 d^{2} x^{2}}{2}+3\right ) \sin \left (d x \right )}{6 \sqrt {\pi }\, d^{3}}\right )}{d^{2} \sqrt {d^{2}}}+\frac {4 b \sqrt {\pi }\, \cos \left (c \right ) \left (-\frac {1}{2 \sqrt {\pi }}+\frac {\left (-\frac {d^{2} x^{2}}{2}+1\right ) \cos \left (d x \right )}{2 \sqrt {\pi }}+\frac {d x \sin \left (d x \right )}{2 \sqrt {\pi }}\right )}{d^{3}}+\frac {2 a \sqrt {\pi }\, \sin \left (c \right ) \left (-\frac {1}{2 \sqrt {\pi }}+\frac {\cos \left (d x \right )}{2 \sqrt {\pi }}+\frac {d x \sin \left (d x \right )}{2 \sqrt {\pi }}\right )}{d^{2}}+\frac {2 a \sqrt {\pi }\, \cos \left (c \right ) \left (-\frac {d x \cos \left (d x \right )}{2 \sqrt {\pi }}+\frac {\sin \left (d x \right )}{2 \sqrt {\pi }}\right )}{d^{2}}\) \(180\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x*(b*x+a)*sin(d*x+c),x,method=_RETURNVERBOSE)

[Out]

1/d^2*(a*c*cos(d*x+c)+a*(sin(d*x+c)-(d*x+c)*cos(d*x+c))-1/d*b*c^2*cos(d*x+c)-2/d*b*c*(sin(d*x+c)-(d*x+c)*cos(d
*x+c))+1/d*b*(-(d*x+c)^2*cos(d*x+c)+2*cos(d*x+c)+2*(d*x+c)*sin(d*x+c)))

________________________________________________________________________________________

Maxima [A]
time = 0.31, size = 117, normalized size = 1.80 \begin {gather*} \frac {a c \cos \left (d x + c\right ) - \frac {b c^{2} \cos \left (d x + c\right )}{d} - {\left ({\left (d x + c\right )} \cos \left (d x + c\right ) - \sin \left (d x + c\right )\right )} a + \frac {2 \, {\left ({\left (d x + c\right )} \cos \left (d x + c\right ) - \sin \left (d x + c\right )\right )} b c}{d} - \frac {{\left ({\left ({\left (d x + c\right )}^{2} - 2\right )} \cos \left (d x + c\right ) - 2 \, {\left (d x + c\right )} \sin \left (d x + c\right )\right )} b}{d}}{d^{2}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*(b*x+a)*sin(d*x+c),x, algorithm="maxima")

[Out]

(a*c*cos(d*x + c) - b*c^2*cos(d*x + c)/d - ((d*x + c)*cos(d*x + c) - sin(d*x + c))*a + 2*((d*x + c)*cos(d*x +
c) - sin(d*x + c))*b*c/d - (((d*x + c)^2 - 2)*cos(d*x + c) - 2*(d*x + c)*sin(d*x + c))*b/d)/d^2

________________________________________________________________________________________

Fricas [A]
time = 0.34, size = 48, normalized size = 0.74 \begin {gather*} -\frac {{\left (b d^{2} x^{2} + a d^{2} x - 2 \, b\right )} \cos \left (d x + c\right ) - {\left (2 \, b d x + a d\right )} \sin \left (d x + c\right )}{d^{3}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*(b*x+a)*sin(d*x+c),x, algorithm="fricas")

[Out]

-((b*d^2*x^2 + a*d^2*x - 2*b)*cos(d*x + c) - (2*b*d*x + a*d)*sin(d*x + c))/d^3

________________________________________________________________________________________

Sympy [A]
time = 0.14, size = 82, normalized size = 1.26 \begin {gather*} \begin {cases} - \frac {a x \cos {\left (c + d x \right )}}{d} + \frac {a \sin {\left (c + d x \right )}}{d^{2}} - \frac {b x^{2} \cos {\left (c + d x \right )}}{d} + \frac {2 b x \sin {\left (c + d x \right )}}{d^{2}} + \frac {2 b \cos {\left (c + d x \right )}}{d^{3}} & \text {for}\: d \neq 0 \\\left (\frac {a x^{2}}{2} + \frac {b x^{3}}{3}\right ) \sin {\left (c \right )} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*(b*x+a)*sin(d*x+c),x)

[Out]

Piecewise((-a*x*cos(c + d*x)/d + a*sin(c + d*x)/d**2 - b*x**2*cos(c + d*x)/d + 2*b*x*sin(c + d*x)/d**2 + 2*b*c
os(c + d*x)/d**3, Ne(d, 0)), ((a*x**2/2 + b*x**3/3)*sin(c), True))

________________________________________________________________________________________

Giac [A]
time = 3.65, size = 49, normalized size = 0.75 \begin {gather*} -\frac {{\left (b d^{2} x^{2} + a d^{2} x - 2 \, b\right )} \cos \left (d x + c\right )}{d^{3}} + \frac {{\left (2 \, b d x + a d\right )} \sin \left (d x + c\right )}{d^{3}} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*(b*x+a)*sin(d*x+c),x, algorithm="giac")

[Out]

-(b*d^2*x^2 + a*d^2*x - 2*b)*cos(d*x + c)/d^3 + (2*b*d*x + a*d)*sin(d*x + c)/d^3

________________________________________________________________________________________

Mupad [B]
time = 4.50, size = 62, normalized size = 0.95 \begin {gather*} \frac {a\,\sin \left (c+d\,x\right )+2\,b\,x\,\sin \left (c+d\,x\right )}{d^2}-\frac {a\,x\,\cos \left (c+d\,x\right )+b\,x^2\,\cos \left (c+d\,x\right )}{d}+\frac {2\,b\,\cos \left (c+d\,x\right )}{d^3} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x*sin(c + d*x)*(a + b*x),x)

[Out]

(a*sin(c + d*x) + 2*b*x*sin(c + d*x))/d^2 - (a*x*cos(c + d*x) + b*x^2*cos(c + d*x))/d + (2*b*cos(c + d*x))/d^3

________________________________________________________________________________________